home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Blitter / RandomPlot.s < prev    next >
Text File  |  1997-12-16  |  3KB  |  125 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Random Plot
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This is a graphical demonstration of the Random() functions.  The default
  7. ;is to use FastRandom, but you can change it to SlowRandom if you look
  8. ;below.
  9. ;
  10. ;LMB exits.
  11.  
  12.     INCDIR    "GMSDev:Includes/"
  13.     INCLUDE    "dpkernel/dpkernel.i"
  14.  
  15. Random    =    _LVOFastRandom    ;_LVOFastRandom() or _LVOSlowRandom().
  16.  
  17.     SECTION    "Demo",CODE
  18.  
  19. ;===========================================================================;
  20. ;                             INITIALISE DEMO
  21. ;===========================================================================;
  22.  
  23.     STARTDPK
  24.  
  25. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  26.     move.l    DPKBase(pc),a6
  27.     lea    ScreenTags(pc),a0
  28.     CALL    Init
  29.     tst.l    d0
  30.     beq.s    .Exit
  31.  
  32.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  33.     CALL    Get
  34.     move.l    d0,JoyData
  35.     beq.s    .Exit
  36.     move.l    d0,a0    ;Initialise the joydata structure.
  37.     CALL    Init
  38.     tst.l    d0
  39.     beq.s    .Exit
  40.  
  41.     move.l    Screen(pc),a0
  42.     CALL    Display
  43.  
  44.     bsr.s    Main
  45.  
  46. .Exit    move.l    DPKBase(pc),a6
  47.     move.l    JoyData(pc),a0
  48.     CALL    Free
  49.     move.l    Screen(pc),a0
  50.     CALL    Free
  51.     MOVEM.L    (SP)+,A0-A6/D1-D7
  52.     moveq    #ERR_OK,d0
  53.     rts
  54.  
  55. ;===========================================================================;
  56. ;                                MAIN LOOP
  57. ;===========================================================================;
  58.  
  59. Main:
  60. .loop    move.l    DPKBase(pc),a6
  61.     move.l    JoyData(pc),a0
  62.     CALL    Query
  63.     move.l    JoyData(pc),a0
  64.     move.l    JD_Buttons(a0),d0
  65.     btst    #JB_LMB,d0
  66.     bne.s    .done
  67.  
  68.     move.l    Screen(pc),a0
  69.     move.l    GS_Bitmap(a0),a1
  70.     move.l    BMP_AmtColours(a1),d1    ;Get random colour.
  71.     subq.l    #1,d1
  72.     jsr    Random(a6)    ;>> = Get random number.
  73.     addq.l    #1,d0
  74.     move.l    d0,d3    ;d3 = Colour to use.
  75.  
  76.     move.w    GS_Width(a0),d1    ;Get random X.
  77.     jsr    Random(a6)    ;>> = Get random number.
  78.     move.w    d0,d4    ;d4 = Store X to use.
  79.  
  80.     move.w    GS_Height(a0),d1    ;Get random Y.
  81.     jsr    Random(a6)    ;>> = Get random number.
  82.     move.w    d0,d2    ;d2 = Y to use.
  83.     move.w    d4,d1    ;d1 = Get back X.
  84.  
  85.     move.l    BLTBase(pc),a6
  86.     move.l    Screen(pc),a0
  87.     move.l    GS_Bitmap(a0),a0
  88.     CALL    bltDrawUCPixel
  89.     bra.s    .loop
  90.  
  91. .done    rts
  92.  
  93. ;===========================================================================;
  94. ;                                  DATA
  95. ;===========================================================================;
  96.  
  97. JoyData:    dc.l  0
  98. ScreenTags:    dc.l  TAGS_SCREEN
  99. Screen:        dc.l  0
  100.         dc.l  GSA_Palette,.palette
  101.         dc.l    GSA_BitmapTags,0
  102.         dc.l    BMA_AmtColours,32
  103.         dc.l    TAGEND,0
  104.         dc.l  GSA_Width,640
  105.         dc.l  GSA_Height,512
  106.         dc.l  GSA_ScrMode,HIRES|LACED
  107.         dc.l  TAGEND
  108.  
  109. .palette    dc.l  PALETTE,32
  110.         dc.l  $000000,$109000,$F0C0B0,$F0A090,$D08080,$906050
  111.         dc.l  $604040,$201010,$400060,$404040,$F0F000,$403020
  112.         dc.l  $C0C000,$109000,$500010,$808000,$206010,$207010
  113.         dc.l  $308020,$409020,$50A030,$50B040,$607070,$60C040
  114.         dc.l  $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020
  115.         dc.l  $700010,$600010
  116.  
  117. ;===========================================================================;
  118.  
  119. ProgName:    dc.b  "Random Plot",0
  120. ProgAuthor:    dc.b  "Paul Manias",0
  121. ProgDate:    dc.b  "15 December 1997",0
  122. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  123. ProgShort:    dc.b  "Random pixel plotter.",0
  124.         even
  125.